package com.hznu.jspFinal.service;

import com.hznu.jspFinal.dao.SchoolMapper;
import com.hznu.jspFinal.entity.School;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SchoolServiceImpl implements SchoolService{
    @Autowired
    private SchoolMapper schoolMapper;

    @Override
    public void insert(School school) {
        schoolMapper.insert(school);
    }

    @Override
    public void delete(Integer id) {
        schoolMapper.deleteByPrimaryKey(id);
    }

    @Override
    public void update(School school) {
        schoolMapper.updateByPrimaryKeySelective(school);
    }

    @Override
    public School findBySchoolId(Integer id) {
        return schoolMapper.selectByPrimaryKey(id);
    }

    @Override
    public School findBySchoolName(String name) {
        return schoolMapper.selectBySchoolName(name);
    }

    @Override
    public List<School> findAll() {
        return schoolMapper.selectAll();
    }
}
